﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


namespace MDA
{
    /// <summary>
    /// CurrentUser 的摘要说明

    /// </summary>
    public class CurrentUser
    {
        public CurrentUser()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }

        /// <summary>
        /// 登录日志ID号,即T_LOG_MOSTLYData.ID.标示本次登录。

        /// </summary>
        public string LogId
        {
            get
            {
                if (HttpContext.Current.Session["LogId"] == null)
                {
                    string rd = FormsAuthentication.LoginUrl;
                    //string script = "window.open('" + rd + "','_top','');";
                    //PageStyle.RegisterStartScript(this.Page, script);
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Write("<script>window.open('" + rd + "','_top','');</script>");
                    HttpContext.Current.Response.End();
                }
                return HttpContext.Current.Session["LogId"].ToString();
            }
            set
            {
                HttpContext.Current.Session["LogId"] = value;
            }
        }

        /// <summary>
        /// 用户登录信息
        /// </summary>
        //public T_LOG_MOSTLYData LOG
        //{
        //    get
        //    {
        //        T_LOG_MOSTLYData data = new T_LOG_MOSTLYData();
        //        data.SEQ = int.Parse(LogId);
        //        T_LOG_MOSTLYAccess ac = new T_LOG_MOSTLYAccess();
        //        ac.Select(data);
        //        return data;
        //    }
        //}

        /// <summary>
        /// 用户当前访问的菜单信息

        /// </summary>
        //public T_MENUData MENU
        //{
        //    get
        //    {
        //        string url = HttpContext.Current.Request.RawUrl;
        //        MenuRule mr = new MenuRule();
        //        int menuid = mr.GetMenu_ID(url);
        //        T_MENUData data = new T_MENUData();
        //        data.MENUID = menuid;
        //        T_MENUAccess ac = new T_MENUAccess();
        //        ac.Select(data);
        //        return data;
        //    }
        //}

        /// <summary>
        /// 当前访问用户
        /// </summary>
        //public T_USERData USER
        //{
        //    get
        //    {
        //        string username = LOG.USERNAME;
        //        T_USERData data = new T_USERData(username);
        //        T_USERAccess ac = new T_USERAccess();
        //        ac.Select(data);
        //        return data;
        //    }
        //}



    }
}